import time

from Lian8_26.Page import Page
from selenium.webdriver.common.by import By

class Page2(Page):
    def scrool(self):
        self.scroll_x(1000)

    dizhi_loc=(By.XPATH,'/html/body/div[5]/div[1]/div[2]/div[4]/div[2]/ul/li[1]/a')
    def dizhi(self):
        self.click(self.dizhi_loc)
    add_address_loc=(By.XPATH,'/html/body/div[5]/div[2]/div/div[1]/a')
    def add_address(self):
        self.click(self.add_address_loc)
    sf_loc=(By.XPATH,'//*[@id="layui-layer1"]/div[2]/div/div/form/div[1]/div[1]/div/div/input')
    def sf(self):
        self.click(self.sf_loc)
    sfone_loc=(By.XPATH,'//*[@id="layui-layer1"]/div[2]/div/div/form/div[1]/div[1]/div/dl/dd[2]')
    def sfone(self):
        self.click(self.sfone_loc)

    #请选择市  //*[@id="layui-layer1"]/div[2]/div/div/form/div[1]/div[2]/div/div/input

    shi_loc = (By.XPATH,'//*[@id="layui-layer1"]/div[2]/div/div/form/div[1]/div[2]/div/div/input')
    def shi(self):
        self.click(self.shi_loc)
    #选择北京市 //*[@id="layui-layer1"]/div[2]/div/div/form/div[1]/div[2]/div/dl/dd[2]
    shi_loc1 = (By.XPATH,'//*[@id="layui-layer1"]/div[2]/div/div/form/div[1]/div[2]/div/dl/dd[2]')
    def shi1(self):
        self.click(self.shi_loc1)
    #定位选择区 //*[@id="layui-layer1"]/div[2]/div/div/form/div[1]/div[3]/div/div/input
    qu_loc = (By.XPATH,'//*[@id="layui-layer1"]/div[2]/div/div/form/div[1]/div[3]/div/div/input')
    def qu(self):
        self.click(self.qu_loc)

    #东城区 //*[@id="layui-layer1"]/div[2]/div/div/form/div[1]/div[3]/div/dl/dd[2]
    dongc_loc = (By.XPATH,'//*[@id="layui-layer1"]/div[2]/div/div/form/div[1]/div[3]/div/dl/dd[2]')
    def dongc(self):
        self.click(self.dongc_loc)

    #定位的收货人 //*[@id="layui-layer1"]/div[2]/div/div/form/div[2]/div/input
    shouhuo_loc = (By.XPATH,'//*[@id="layui-layer1"]/div[2]/div/div/form/div[2]/div/input')
    def shouhuo(self):
        self.send_keys(self.shouhuo_loc,'魏蛋')

    #定位的手机号 //*[@id="layui-layer1"]/div[2]/div/div/form/div[3]/div/input
    sjh_loc = (By.XPATH,'//*[@id="layui-layer1"]/div[2]/div/div/form/div[3]/div/input')
    def sjh(self):
        self.send_keys(self.sjh_loc,'18519740185')
    #街道搬出 //*[@id="layui-layer1"]/div[2]/div/div/form/div[5]/div/textarea
    banchu_loc = (By.XPATH,'//*[@id="layui-layer1"]/div[2]/div/div/form/div[5]/div/textarea')
    def banchu(self):
        self.send_keys(self.banchu_loc,'1')

    #点击立即提交 //*[@id="layui-layer1"]/div[2]/div/div/form/div[6]/div/button[1]

    liji_loc = (By.XPATH,'//*[@id="layui-layer1"]/div[2]/div/div/form/div[6]/div/button[1]')
    def liji(self):
        self.click(self.liji_loc)

    def luoji_A3mall(self):
        self.scrool()
        self.dizhi()
        time.sleep(3)
        self.add_address()
        time.sleep(3)
        self.sf()
        time.sleep(3)
        self.sfone()
        time.sleep(3)
        self.shi()
        time.sleep(3)
        self.shi1()
        time.sleep(3)
        self.qu()
        time.sleep(2)
        self.dongc()
        time.sleep(2)
        self.shouhuo()
        time.sleep(2)
        self.sjh()
        time.sleep(3)
        self.banchu()
        time.sleep(3)
        self.liji()
        time.sleep(5)